import java.util.Arrays;

public class TestDemo {
    /////////////////////////////////////////////
    ////数组拷贝
    public static int copyOf(int[] array){

    }

    public static void main(String[] args) {
        int[] array = {1,2,3,4,5,6};
        int[] ret = copyArray(array);
        System.out.println(Arrays.toString(array));
    }




    /////////////////////////////////////////
    //偶数放到奇数的前边
    public static void func(int[] array){
        int i = 0;
        int j = array.length-1;
        while(i < j){
            while(i < j && array[i] % 2 == 0){
                i++;
            }//i下标一定是奇数
            while(i < j && array[j] % 2 != 0){
                j--;
            }
            int tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;
        }
    }
    public static void main4(String[] args) {
        int[] array = {1,2,3,4,5,6};
        func(array);
        System.out.println(Arrays.toString(array));
    }

    //////////////////////////////////////
    //数组逆序
    public static void reverse(int[] array){
        int i = 0;
        int j = array.length-1;
        while(i < j){
            int tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;
            i++;
            j--;
        }
    }
    public static void main2(String[] args) {
        int[] array = {1,2,3,4,5};
        reverse(array);
        System.out.println(Arrays.toString(array));
    }



    //填充
    ////////////////////////////////////////////////////
    public static void main1(String[] args) {
        int[] array = new int[10];
        Arrays.fill(array,2,6,999);
        System.out.println(Arrays.toString(array));
    }
}
